package com.collectplus.express.passport;

import android.app.Activity;
import android.content.Intent;
import android.text.Html;
import android.view.View;
import android.widget.TextView;

import com.collectplus.express.R;
import com.collectplus.express.logic.AppHttp;
import com.collectplus.express.model.CollectingPassportBean;
import com.collectplus.express.parcel.ParcelWaitTakeActivity;

import java.text.MessageFormat;

import droid.frame.activity.base.BaseViewStub;

/**
 * Created by lidandan on 2018/3/5.
 * passport代收包裹
 */
public class NewPassportCollectingOperate extends BaseViewStub {
    private CollectingPassportBean item;
    private String tipStr = "<font color=#333333>共有</font><font color=#ff001f>{0}个</font><font color=#333333>包裹在该店</font>";
    public NewPassportCollectingOperate(Activity context, int resId) {
        super(context, resId);
    }

    public void loadLayout(final CollectingPassportBean item) {
        super.inflate();
        this.item = item;
        TextView stationTimeTv = (TextView) findViewById(R.id.station_time_tv);
        TextView parcelNumTv = (TextView) findViewById(R.id.parcel_num_tv);
        stationTimeTv.setText(item.getCreateTime());
        parcelNumTv.setText(Html.fromHtml(MessageFormat.format(tipStr,item.getTotal())));
        findViewById(R.id.take_parcel).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getContext(), ParcelWaitTakeActivity.class);
                intent.putExtra("item",item);
                getContext().startActivity(intent);
            }
        });
    }

}
